package com.laoxiang.modules.system.controller;

import com.laoxiang.execption.LxAdminException;
import com.laoxiang.utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author db
 * @version 1.0
 * @description TestController
 * @since 2023/7/23
 */
@Api(tags = "测试")
@RestController
@RequestMapping("/test")
public class TestController {

    @ApiOperation(httpMethod = "POST", value = "测试异常")
    @PostMapping ("/testError")
    public ResponseResult<Object> testError(){
        try{
            int a = 10/0;
        }catch(Exception e){
            throw new LxAdminException(10001,"出现异常");
        }
        return ResponseResult.okResult();
    }
}
